package dao

import (
	__ "shop-microservices/basic/goods_proto"
	"shop-microservices/handler/models"
)

func CarouselShow() ([]*__.Carousel, error) {
	var carousel models.Carousel
	list, err := carousel.CarouselList()
	if err != nil {
		return nil, err
	}
	var List []*__.Carousel
	for _, c := range list {
		List = append(List, &__.Carousel{
			SliderImage:  c.SliderImage,
			Title:        c.Title,
			Status:       int64(c.Status),
			CarouselType: int64(c.CarouselType),
			CreatedAt:    c.CreatedAt.Format("2006-01-02"),
		})
	}
	return List, nil
}
